﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using MM.Common.Base;
using MM.Common.DBBase;

namespace MMTJ
{
    public partial class FrmInputCode : XtraForm
    {
        public FrmInputCode()
        {
            InitializeComponent();
            if (SystemInfo.OperInputCode == "1")
            {
                this.rgInputCode.SelectedIndex = 0;
            }
            else
            {
                this.rgInputCode.SelectedIndex = 1;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            string paramValue = "1";
            if (this.rgInputCode.SelectedIndex == 1)
            {
                paramValue = "2";
            }
            if (paramValue != SystemInfo.OperInputCode)
            {
                DataParamCol parms = new DataParamCol(new DataParam[] { new InputDataParam("srmlx", paramValue), new InputDataParam("operid", SystemInfo.OperId) });
                if (SystemInfo.DbData.ExecuteSql("UPDATE MXH_EMPLOYEE SET INPUT_CHOICE = :srmlx WHERE EMP_ID = :operid ", parms) == 1)
                {
                    SystemInfo.OperInputCode = paramValue;
                    base.DialogResult = DialogResult.OK;
                    base.Close();
                }
            }
        }

    }
}
